/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sts;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

/**
 *
 * @author gspfranc
 */
public class Importateur {

    ArrayList<Ligne> listeLigne = new ArrayList();

    public void Imp() {
        String chaine = "";
        String fichier = "4.csv";
        Ligne ligne = new Ligne();

        //lecture du fichier texte
        try {
            InputStream ips = new FileInputStream(fichier);
            InputStreamReader ipsr = new InputStreamReader(ips);
            BufferedReader r = new BufferedReader(ipsr);
            String l = r.readLine();
            StringTokenizer st = new StringTokenizer(l, ";");

            ligne.setLigne(Integer.parseInt(st.nextToken()));
            System.out.println("Ligne #:" + ligne.getLigne());
            int direction = Integer.parseInt(st.nextToken());
            if (direction == 1) {
                ligne.setDirection1(st.nextToken());
                System.out.println("Direction: " + ligne.getDirection1());
            } else {
                ligne.setDirection2(st.nextToken());
                System.out.println("Direction: " + ligne.getDirection2());
            }
int horaire = Integer.parseInt(st.nextToken());
System.out.println("Période: " + horaire);
            String Arrets[]= r.readLine().split(";");
            ligne.setListeArret(Arrets);
            ligne.AfficherListeArret();


                    while ((l = r.readLine()) != null) {

                System.out.println(l);

            }
            r.close();
        } catch (Exception e) {
            System.out.println(e.toString());
        }

    }
}
